<?php
/*

	‘орм-процессор
	* see http://in.jetstyle.ru/rocket/rocketforms

	FormComponent_interface_string( &$config )
			- $field -- $field->config instance-a пол€  

	-------------------

	* interface   : —“–ќ ј. типовой интерфейс строки

	-------------------

	// »нтерфейс (парсинг и обработка данных)

	* Interface_SafeDataValue( $data_value )
	* Interface_Parse()
	* Interface_PostToArray( $post_data )

================================================================== v.0 (kuso@npj)
 */

class FormComponent_filter_safehtml extends FormComponent_abstract
{

	public function filtrate ()
	{
		$value = $this->field->model->Model_GetDataValue();
		if (isset($this->field->config['filter_params'])) {
			$rules = $this->field->config['filter_params'];
		} else {
			$rules = array();
		}
		//var_dump($value);
		$value = $this->process_safehtml($value, $rules);
		//var_dump($value);
		//die();
		$this->field->model->Model_SetDataValue($value);
	} // end of method filter

	public function process_safehtml ($value, $rules)
	{
		define('XML_HTMLSAX3', "safehtml/classes/");
		$this->field->rh->UseClass("safehtml_classes_safehtml");

		$safehtml =& new safehtml();
		foreach ($rules as $k => $v) { $safehtml->$k = $v; }
		return $safehtml->parse($value);
	} // end of method filterDom

}

